class Solution(object):
    def chalkReplacer(self, chalk, k):
        t = sum(chalk)
        r = k % t
        for index, num in enumerate(chalk):
            if num > r:
                return index
            else:
                r -= num
